package top.stmo.dao;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import top.stmo.pojo.Books;

import java.util.List;

@Mapper
public interface BooksDao {

    @Insert("insert into tbl_book(type,name,description) values(#{type},#{name},#{description})")
    boolean save(Books books);

    @Select("select * from tbl_book")
    List<Books> getAll();

    @Select("select * from tbl_book where id = #{id}")
    Books getById(Integer id);

    @Delete("delete from tbl_book where id = #{id}")
    boolean delete(Integer id);

    @Update("update tbl_book set type = #{type},name = #{name},description = #{description} where id = #{id}")
    boolean update(Books books);
}
